fe8a50ea5a678a6a3020e83d3e9ffde6b21a8a57,public/java/src/org/broadinstitute/sting/utils/GenomeLocParser.java,GenomeLocParser,validateGenomeLoc,#String#number#number#number#boolean#boolean#,311
Before Change
* @return true if it's valid, false otherwise. If exceptOnError, then throws a UserException if invalid
*/
private boolean validateGenomeLoc(String contig, int contigIndex, int start, int stop, boolean mustBeOnReference, boolean exceptOnError) {
if ( ! getContigInfo().hasContig(contig) )
return vglHelper(exceptOnError, String.format("Unknown contig %s", contig));
if (stop < start)
return vglHelper(exceptOnError, String.format("The stop position %d is less than start %d in contig %s", stop, start, contig));
if (contigIndex < 0)
return vglHelper(exceptOnError, String.format("The contig index %d is less than 0", contigIndex));
if (contigIndex >= getContigInfo().getNSequences())
return vglHelper(exceptOnError, String.format("The contig index %d is greater than the stored sequence count (%d)", contigIndex, getContigInfo().getNSequences()));
if ( mustBeOnReference ) {
if (start < 1)
return vglHelper(exceptOnError, String.format("The start position %d is less than 1", start));
if (stop < 1)
return vglHelper(exceptOnError, String.format("The stop position %d is less than 1", stop));
int contigSize = getContigInfo().getSequence(contigIndex).getSequenceLength();
if (start > contigSize || stop > contigSize)
return vglHelper(exceptOnError, String.format("The genome loc coordinates %d-%d exceed the contig size (%d)", start, stop, contigSize));
}
// we passed
return true;
}
public boolean isValidGenomeLoc(String contig, int start, int stop, boolean mustBeOnReference ) {
After Change
* @return the interned contig name, an optimization that ensures that contig == the string in the sequence dictionary
*/
protected String validateGenomeLoc(final String contig, final int contigIndex, final int start, final int stop, final boolean mustBeOnReference) {
if ( validationLevel == ValidationLevel.NONE )
return contig;
else {
if (stop < start)
vglHelper(String.format("The stop position %d is less than start %d in contig %s", stop, start, contig));
final SAMSequenceRecord contigInfo = getContigInfo().getSequence(contig);
if ( contigInfo.getSequenceIndex() != contigIndex )